package _02_链表;

public class _160_相交链表 {


    // 使得两个链表长度相等，这样如果当前值相同，者是相交的
    public ListNode getIntersectionNode(ListNode first, ListNode second) {
        ListNode headA = first;
        ListNode headB = second;
        while (headA != headB) {
            headA = headA == null? second: headA.next;
            headB = headB == null? first: headB.next;
        }
        return headA;
    }

}
